home *** CD-ROM | disk | FTP | other *** search
/ Mac Format 1996 April / MacFormat CD Edition MF36 (April 1996).iso / Floppy / MacFormat Floppy Archive / MacFormat 18 / Chipmunk-basic-29b5 / chipbasic2.9b5.README < prev    next >
Text File  |  1994-04-02  |  5KB  |  123 lines

  1. *chipmunk-basic-29b5-ppc.hqx README*
  2.  
  3. Every *real* personal computer should come with a BASIC interpreter.
  4. Here's my contribution for the new Power Macintosh machines.  It's a
  5. line number based BASIC interpreter similar to the BASIC that came
  6. with the Apple ][+ (that's Apple ][, *NOT* Mac II for you newcomers).
  7. Version 2.9b5 is a fat binary that runs on both Power Macs and 68k Macs.
  8.  
  9. Chipmunk Basic is a simple Basic interpreter for the Macintosh.  It is
  10. similar to the line number based MumbleSoft BASIC interpreters of circa
  11. 1980.  Its roots are from a pascal program, basic.p, that was part of
  12. the test input suite to p2c, a pascal to c translator.  Both basic.p
  13. and p2c should be in the net.sources archives somewhere (I no longer
  14. have copies).  I cleaned up the translated source, ported it to the Mac
  15. and added some Mac specific features.
  16.  
  17. Chipmunk Basic 2.9 is being distributed as freeware (but only for those
  18. who don't believe that using the BASIC language causes brain damage. :-)
  19. Please note that there are far better versions of BASIC available
  20. commercially.  Just none that run PowerPC native and were available for
  21. the Mac as of March 14th.  It's not very fast as BASIC systems go. But
  22. it does run 110 to 150 times faster on a PowerMac 7100/66 than Microsoft
  23. BASIC 1.0 did on the original Mac 128.  Have fun.  And please email any
  24. bugs reports.
  25.  
  26. This program is distributed in the hope that it will be useful, but
  27. WITHOUT ANY WARRANTY; not even the implied warranty of MERCHANTABILITY
  28. or FITNESS FOR A PARTICULAR PURPOSE.
  29.  
  30. 2.9b0 first native PowerPC port.
  31. 2.9b2 virtual memory crash bug fixed.
  32. 2.9b4 fat binary.
  33. 2.9b5 allows color Picts to be copied.
  34.  
  35. ---
  36. Quick Reference for Chipmunk Basic v2.9 - PPC Macintosh version 94-Mar-14
  37. ported by Ronald H. Nicholson, Jr.    rhn@netcom.com
  38.  
  39. - The interpreter includes an old fashioned line number based editor.
  40. - The usual amount of numeric and string operators and functions and
  41.     file I/O statements are available.
  42. - The two variable types are long floats and strings with a maximum length
  43.     of 254 characters.  Variable names can be up to 32 characters long and
  44.     are case insensitive.
  45. - Unusual features include:
  46.     The ability to play accurate morse code through the sound manager.
  47.     Some simple graphics commands in a separate graphics window.
  48.  
  49. Operator, functions and statements include:
  50.  
  51.     + - * / ^ mod and or xor not
  52.     sqr() log() exp() abs() sgn() sin() cos() tan() log() arctan()
  53.     int() rnd() peek() val() asc() len() fre
  54.     mid$() right$() left$() str$() chr$()
  55.     let goto gosub return for to step next while wend dim data read def
  56.     rem input print open input# output append as close# load save run
  57.     inkey$ date$ time$
  58.     timer eof() peek() poke
  59.     stop end exit quit renum new
  60.     moveto lineto gotoxy graphics() mouse() cls sound morse
  61.     
  62. Some Examples:
  63.  
  64.   open "filename" for output as #1 : print #1, a$ : close #1
  65.   c$ = a$ + b$                : rem string concatenation
  66.   
  67.   graphics(0) : moveto 10,10 : lineto 110,80    : rem graphics window
  68.   gotoxy 0,10 : print "here"        : rem text window
  69.   sound 440,0.5,30            : rem freq, seconds_duration, vol 0-100
  70.   sound 0,128                : rem play snd resource 128
  71.   morse "CQ DE N6YWU",16,40,13,700    : rem dot_wpm,vol,letter_wpm,freq
  72.   open "SFGetFile" for input as #2    : rem "SFPutFile" works for output
  73.   
  74.   some experimental graphics commands:
  75.   (The graphics commands in version 2.9b are beta test and may be buggy.)
  76.     
  77.     GRAPHICS 0                // init graphics window
  78.  
  79.     graphics MOVETO  x,y            // MoveTo
  80.     graphics LINETO  x,y            // LineTo
  81.     graphics OVAL  x,y            // oval  x wide by y high
  82.     graphics DRAWTEXT  a$            // DrawText
  83.     
  84.     graphics RECT  x1,y1,x2,y2        // FrameRect
  85.     graphics FILLRECT  x1,y1,x2,y2,pat#    // PaintRect
  86.     graphics OVAL  x1,y1,x2,y2        // FrameOval
  87.     graphics FILLOVAL  x1,y1,x2,y2,pat#    // PaintOval
  88.     graphics PENSETUP  xsize, ysize, [ mode, pat# ]
  89.     graphics COLOR  i            // set RGBForeColor by index
  90.     graphics COLOR  r,g,b            // red green blue 0-100
  91.  
  92.     graphics TEXTSETUP f, s, m        // font, size, mode
  93.  
  94.     SPRITE    n  x, y, id        // sprite n @ x,y using ICN# id
  95.                     // n from 1 to 15, 1 in frontmost plane
  96.     sprite    n  UP    x        // sprite #n move up x pixels
  97.     sprite  n  DOWN  x
  98.     sprite  n  LEFT  x        // move LEFT (not turn as in Logo!)
  99.     sprite  n  RIGHT   x
  100.     sprite    n  TURN    d        // turn CCW d degrees
  101.     sprite    n  FORWARD x        // move forward x pixels
  102.     sprite    n  PENUP
  103.     sprite    n  PENDOWN
  104.  
  105. ---
  106. 1 rem sieve benchmark
  107. 2 t = timer
  108. 3 dim f(8194)
  109. 4 for i = 0 to 8191 : f(i) = 1 : next i
  110. 5 s = 8191
  111. 6 for i = 0 to s
  112. 7   if f(i) = 0 then goto 11
  113. 8   p = i+i+3
  114. 9   for k = i+p to s step p : f(k) = 0 : next k
  115. 10   c = c+1
  116. 11 next i
  117. 12 print c;" primes found in ";
  118. 13 t = timer-t
  119. 14 print t;" seconds"
  120. 15 end
  121.  
  122. --- cut here ---
  123.